<template>
	<view>
		<!-- #ifdef MP-WEIXIN -->
			<button type="primary"  open-type="getUserInfo" @getuserinfo="getuserinfo" withCredentials="true" >授权登录</button>
		<!-- #endif -->
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onLoad() {
			
		},
	
		methods: {
			getuserinfo(res){
				if(!res.detail.iv){
					uni.showModal({
						title:"您取消了授权,登录失败",
						icon:'none',
					})
					return false
				}
				wx.cloud.callFunction({
					name: "test-uniapp",//这里填写云函数的名字
				    success: res => {
						console.log(res) // 返回的文本如下图所示：
				    },
				    fail: err => {
				        console.log(err)
				     }
				})
				
			},
		}
	}
</script>

<style>

</style>
